package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.DepositRuleDO;

import javax.validation.constraints.NotNull;

/**
 * Created by well on 15/11/12.
 */
public class DepositRuleEditForm extends DepositRuleForm{

    @NotNull(message = "不能为空")
    private Long ruleId;

    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public void initForm(DepositRuleDO depositRuleDO){
        setRuleId(depositRuleDO.getRuleId());
        setRuleStatus(depositRuleDO.getRuleStatus());
        setVarId(depositRuleDO.getVarId());
        setFee(PriceUtil.formatCNY(depositRuleDO.getFee()));
        setVillageId(depositRuleDO.getVillageId());
    }

    public DepositRuleDO toDO() {
        DepositRuleDO depositRuleDO = super.toDO();
        depositRuleDO.setRuleId(ruleId);
        return depositRuleDO;
    }
}
